package com.shqcjd.yunweiyanoperator.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.shqcjd.yunweiyanoperator.R;
import com.shqcjd.yunweiyanoperator.util.ToastUtils;

public class SendVideoDialog extends Dialog {
    private Button btn_dialog_send;
    private EditText et_dialog_send_info;
    private Context context;
    private RelativeLayout rl_dialog_frenid;
    private TextView tv_dialog_frenid;

    private OnClickDialogListener listener;

    public void setOnClickDialogListener(OnClickDialogListener listener){
        this.listener = listener;
    }

    public SendVideoDialog(@NonNull Context context) {
        super(context);
        this.context = context;
    }

    public SendVideoDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected SendVideoDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_send_video);
        getWindow().setBackgroundDrawableResource(R.color.transparent);
        tv_dialog_frenid = findViewById(R.id.tv_dialog_frenid);
        btn_dialog_send = findViewById(R.id.btn_dialog_send);
        et_dialog_send_info = findViewById(R.id.et_dialog_send_info);
        rl_dialog_frenid = findViewById(R.id.rl_dialog_frenid);

        rl_dialog_frenid.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(listener!=null){
                    listener.onClickFrenid();
                }
            }
        });

        btn_dialog_send.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String info = et_dialog_send_info.getText().toString().trim();
                if(listener!=null){
                    listener.onClickSend(info);
                }
            }
        });

    }

    public void setTvName(String name){
        tv_dialog_frenid.setText(name);
    }



    public interface OnClickDialogListener{
        void onClickSend(String info);
        void onClickFrenid();
    }
}
